<?php
class homeComponents extends sfComponents {

  public function executeHeader(sfWebRequest $request) {
    $twitter = new Twitter(sfConfig::get('app_twitter_consumer_key'), sfConfig::get('app_twitter_consumer_secret'));
    $twitter->setCallbackUrl($this->getController()->genUrl('signin_twitter', true));
    $this->twitterSigninUrl = $twitter->getSigninUrl();

    $facebook = new Facebook(sfConfig::get('app_facebook_app_id'), sfConfig::get('app_facebook_app_secret'));
    $facebook->setCallbackUrl($this->getController()->genUrl('signin_facebook', true));
    $this->facebookSigninUrl = $facebook->getSigninUrl();
  }

  public function executeLeftPanel(sfWebRequest $request) {
    $this->form = new MainSearchForm();
    if ($request->isMethod('post')) {
      $formData = $request->getParameter(UserSignupForm::FORM_NAME);
      $this->form->bind($formData);
    }
  }

  public function executeFooter(sfWebRequest $request) {
    $isLocked = false;
    if (file_exists(sfConfig::get('app_lock_filename'))) {
      $isLocked = true;
    }

    $this->isLocked = $isLocked;
  }
}